package test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


import java.net.*;
//import java.io.*;

public class WatsonSearchEngine extends SDGView {

	public WatsonSearchEngine(String keywords, String ontologyType) 
	{
		super(keywords, ontologyType);		
	}

	public  void search()  {

		String terms=new String(searchTerms);
		terms=terms.trim();
		terms=terms.replace(" ", "+");
		String urlString = "http://watson.kmi.open.ac.uk/API/semanticcontent/keywords/?q="+terms; 

		try {
			URL url = new URL(urlString);
			BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
			String line;
			while ((line = reader.readLine()) != null) {
				  	if (line.endsWith("owl")) listOfUri.add(line);
				
			}
			reader.close();

		} catch (MalformedURLException e) {
			// ...
		} catch (IOException e) {
			// ...
		}


	}


}

